package com.mycattest.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.mycattest.model.TbBlog;
import com.mycattest.service.TbBlogService;
import com.mycattest.utils.PageHelper;
import com.mycattest.utils.ResponseConstant;
import com.mycattest.utils.Return2AndriodFormat;

@RestController
@RequestMapping("/")
public class TbBlogController {
	@Autowired
	TbBlogService TbBlogService;
	
	@RequestMapping("/tbBlog/add")
	public String TbBlogAdd(TbBlog item) {
		Map<String, Object> result = TbBlogService.saveTbBlog(item);
		return JSONObject.toJSONString(Return2AndriodFormat.getResult(ResponseConstant.STATUS_OK, "???", result),SerializerFeature.WriteMapNullValue,SerializerFeature.WriteDateUseDateFormat);
	}
	
	@RequestMapping("/tbBlog/update")
	public String TbBlogUpdate(TbBlog item) {
		Map<String, Object> result = TbBlogService.updateTbBlog(item);
		return JSONObject.toJSONString(Return2AndriodFormat.getResult(ResponseConstant.STATUS_OK, "???", result),SerializerFeature.WriteMapNullValue,SerializerFeature.WriteDateUseDateFormat);
	}
	
	@RequestMapping("/tbBlog/query")
	public String TbBlogQuery(TbBlog item, PageHelper ph) {
		Map<String, Object> result = TbBlogService.queryTbBlog(item, ph);
		return JSONObject.toJSONString(Return2AndriodFormat.getResult(ResponseConstant.STATUS_OK, "???", result),SerializerFeature.WriteMapNullValue,SerializerFeature.WriteDateUseDateFormat);
	}
}
